package com.example.ssm.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.ssm.dao.UserMapper;
import com.example.ssm.dao.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserMapper userMapper;

    @RequestMapping("login")
    public String login(@RequestParam("userName") String userName, @RequestParam("pwd") String pwd){
        User user = userMapper.selectUserByPwd(userName, pwd);
        return JSONObject.toJSONString(user);
    }
}
